package com.ec.fb.enums;

import com.baomidou.mybatisplus.annotation.EnumValue;
import com.ec.common.exception.BadRequestException;
import lombok.Getter;

@Getter
public enum FeedbackStatus {
    PENDING("pending", "待处理"),
    REPLIED("replied", "已回复");

    @EnumValue
    private final String value;
    private final String desc;

    FeedbackStatus(String value, String desc) {
        this.value = value;
        this.desc = desc;
    }

    public static FeedbackStatus of(String value) {
        if ("pending".equals(value)) {
            return PENDING;
        }
        if ("replied".equals(value)) {
            return REPLIED;
        }
        throw new BadRequestException("反馈状态错误");
    }
}